// 过滤器
export const filters = {
    // 手机号加密展示 13022226789 => 130****6789
    formatPhone: value => {
        console.log('value', value);
        if (value == undefined) {
            return;
        }
        const result = value.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2")
        return result
    },
    formatCarno: value => {
        return value.replace(/^(.{2})./, '$1·')
    },
    formatDictLabel: (value, list) => {
        let label = ''
        if (list.length) {
            list.forEach(item => {
                if ((item.value + '') === (value + '')) {
                    label = item.label
                }
            })
        }
        return label
    }
}
